﻿using DH.Entity;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace DH.Data
{
   public static class EFMapper
    {
        public static void Build(this ModelBuilder modelBuilder)
        {
            //用户
            modelBuilder.Entity<UserEntity>(b=> {
                b.ToTable("Sys_User");
                b.HasKey(p => p.Id);
            });

            //组织架构
            modelBuilder.Entity<OrganizeEntity>(b=>{
                b.ToTable("Sys_Organize");
                b.HasKey(p => p.Id);
            });

            //区域
            modelBuilder.Entity<AreaEntity>(b=> {
                b.ToTable("Sys_Area");
                b.HasKey(p => p.Id);
            });

            //资源
            modelBuilder.Entity<CategoryEntity>(b=> {
                b.ToTable("Category");
                b.HasKey(p=>p.Id);
            });

            modelBuilder.Entity<RoleEntity>(b=> {
                b.ToTable("Role");
                b.HasKey(p => p.Id);
            });
            //功能
            modelBuilder.Entity<FeaturesEntity>(b=> {
                b.ToTable("Features");
                b.HasKey(p => p.Id);
            });
            //按钮
            modelBuilder.Entity<ButtonEntity>(b => {
                b.ToTable("Sys_Button");
                b.HasKey(p => p.Id);
            });

            //视图功能按钮
            modelBuilder.Entity<UiFeaturesButtonEntity>(b => {
                b.ToTable("UiFeaturesButton");
                b.HasKey(p => p.Id);
            });

            //权限表
            modelBuilder.Entity<PrivilegeEntity>(b => {
                b.ToTable("Privilege");
                b.HasKey(p => p.Id);
            });
            //菜单
            modelBuilder.Entity<MenuEntity>(b => {
                b.ToTable("Menu");
                b.HasKey(p => p.Id);
            });
        }

    }
}
